# $Id: PKGBUILD 87602 2013-04-04 02:31:51Z kkeen $
# Maintainer: Kyle Keen <keenerd@gmail.com>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Andrew Antle <andrew dot antle at gmail dot com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Chaiwat Suttipongsakul <cwt at bashell dot com>

pkgbase=python-markdown
pkgname=('python-markdown' 'python2-markdown')
_pkgbasename=Markdown
pkgver=2.3.1
pkgrel=1
pkgdesc="Python implementation of John Gruber's Markdown."
arch=('any')
url='http://pypi.python.org/pypi/Markdown'
license=('BSD')
makedepends=('python' 'python2')
source=("http://pypi.python.org/packages/source/M/$_pkgbasename/$_pkgbasename-$pkgver.tar.gz")
md5sums=('82f6828ec2292dda52fc38b743776bc6')

build() {
  cp -r $_pkgbasename-$pkgver "$srcdir/python2-markdown"
  cd "$srcdir/python2-markdown"
  find "$srcdir/python2-markdown" -name '*.py' | xargs sed -i 's|#!/usr/bin/env python$|&2|'
}


package_python-markdown() {
  depends=('python')
  cd $_pkgbasename-$pkgver
  python3 setup.py install --root="$pkgdir" --optimize=0
}

package_python2-markdown() {
  depends=('python2')
  cd "$srcdir/python2-markdown"
  python2 setup.py install --root="$pkgdir" --optimize=0
  mv "$pkgdir/usr/bin/markdown_py" "$pkgdir/usr/bin/markdown_py2"
}
